import time
import os
import django

from fdfs_client.client import Fdfs_client
from django.conf import settings

if __name__ == '__main__':
    # 创建连接对象
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "meiduo_mall.settings.dev")
    django.setup()
    BASE_DIR = settings.BASE_DIR
    print(BASE_DIR)
    conf_path = os.path.join(BASE_DIR, 'utils/fdfs/client.conf')
    print(conf_path)
    client = Fdfs_client(conf_path)
    # client = Fdfs_client('/home/lyf/code2/meiduo_houtai_202002/meiduo_mall/meiduo_mall/utils/fdfs/client.conf')
    # 上传文件
    ret = client.upload_by_filename('/home/lyf/Desktop/2.png')
    # 响应值
    print(ret)
'''

mysql -h127.0.0.1 -uroot -pmysql meiduo_tbd39 < goods_data.sql

{'Local file name': '/home/lyf/Desktop/1.jpg', 
'Status': 'Upload successed.', 
'Uploaded size': '91.00KB', 
'Remote file_id': 'group1/M00/00/00/wKiog15ouruAdJnCAAFuda_uQgY713.jpg', 
'Group name': 'group1', 'Storage IP': '192.168.168.131'}

'''
